package cz.semjob.learning.instances.creator;

import java.util.List;

import org.springframework.stereotype.Component;

import cz.semjob.document.AnnotatedDocument;
import cz.semjob.document.annotation.metadata.Entity;
import cz.semjob.document.processing.DocumentInstance;
import cz.semjob.document.processing.DocumentWord;
import cz.semjob.learning.data.TaxonomyLearningException;
import cz.semjob.learning.instances.LabeledTextInstance;
import cz.semjob.learning.instances.UnlabeledTextInstance;

@Component
public class QualityTextInstanceCreator extends BaseTextInstanceCreator
		implements IConfigurableTextInstanceCreator {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3783486243640126838L;

	public QualityTextInstanceCreator() {
		super();
		// attributesNamesList.remove(HEAD_GENDER);
		// attributesNamesList.remove(HEAD_NUMBER);
		attributesNamesList.remove(TEXT_RELATIVE_POSITION);

	}

	public LabeledTextInstance createOneLabeledInstance(
			AnnotatedDocument annotatedDocument, Entity entity,
			boolean positive, List<DocumentWord> words, Object... dataSources)
			throws TaxonomyLearningException {
		LabeledTextInstance labeledTextInstance = super
				.createOneLabeledInstance(annotatedDocument, entity, positive,
						words);
		return labeledTextInstance;
	}

	protected UnlabeledTextInstance createOneUnlabeledInstance(
			DocumentInstance documentInstance, List<DocumentWord> pathWords)
			throws TaxonomyLearningException {
		UnlabeledTextInstance unlabeledTextInstance = super
				.createOneUnlabeledInstance(documentInstance, pathWords);

		return unlabeledTextInstance;
	}

	public void setMaxInstanceWordLength(int length) {
		MAX_WORDS = length;

	}

	public void setAttributesList(List<String> attributeNames) {
		updateAttributes(attributeNames);
	}

	public String getName() {
		return "Quality";
	}

}
